package com.letwal.cmcvnd.earn.rules

import android.annotation.SuppressLint
import android.view.View
import androidx.lifecycle.ViewModel
import androidx.recyclerview.widget.LinearLayoutManager
import com.letwal.cmcvnd.R
import com.letwal.cmcvnd.base.BaseActivity
import com.letwal.cmcvnd.databinding.ActivityInviteEarnRulesBinding
import com.letwal.cmcvnd.earn.rules.adapter.DataEarnRules
import com.letwal.cmcvnd.enums.PageTagEnum
import com.letwal.cmcvnd.extend.*
import com.letwal.cmcvnd.earn.rules.adapter.EarnRulesAdapter

/** 规则页 */
@SuppressLint("CustomSplashScreen")
class InviteEarnRulesActivity : BaseActivity() {

    //布局binding
    private lateinit var mActivityBinding: ActivityInviteEarnRulesBinding

    //适配器
    private lateinit var mInviteRulesAdapter: EarnRulesAdapter

    override fun onBindingViewModel(): List<ViewModel> {
        val list = mutableListOf<ViewModel>()
        return list
    }

    override fun onBindingViewTag(): String {
        return PageTagEnum.my_wallet.name.uppercase()
    }

    override fun onBindingContentView(): View {
        mActivityBinding =
            ActivityInviteEarnRulesBinding.inflate(layoutInflater)
        return mActivityBinding.root
    }

    override fun onContentViewBinded() {
        try {
            //初始化适配器
            val list = mutableListOf<DataEarnRules>()
            list.add(DataEarnRules(rule = getString(R.string.invite_rules_1)))
            list.add(DataEarnRules(rule = getString(R.string.invite_rules_2)))
            list.add(DataEarnRules(rule = getString(R.string.invite_rules_3)))
            list.add(DataEarnRules(rule = getString(R.string.invite_rules_4)))
            list.add(DataEarnRules(rule = getString(R.string.invite_rules_5)))
            list.add(DataEarnRules(rule = getString(R.string.invite_rules_6)))
            list.add(DataEarnRules(rule = getString(R.string.invite_rules_7)))

            mInviteRulesAdapter = EarnRulesAdapter(list)

            mActivityBinding.listInviteRules.layoutManager = LinearLayoutManager(this)
            mActivityBinding.listInviteRules.adapter = mInviteRulesAdapter

        } catch (e: Exception) {
            e.printStackTrace()
        }
    }

}